# import time
# from selenium import webdriver
# from selenium.webdriver.common.by import By
#
# # 创建浏览器驱动
# driver = webdriver.Chrome()
# # 获取访问页面
# driver.get("http://121.43.169.97:8848/pageA.html")
# # 放大浏览器
# driver.maximize_window()
# time.sleep(1)
# # 模拟用户操作
# # 获取用户名：通过标签ID、标签属性、标签class、标签名
# driver.find_element(By.CSS_SELECTOR, "#userA").send_keys("admin")  # id属性值
# driver.find_element(By.CSS_SELECTOR, "[name='passwordA']").send_keys("123456")  # 标签属性
# driver.find_element(By.CSS_SELECTOR, ".telA").send_keys("13800000001")  # class属性值
# # 输入邮箱信息：多个class值，通过点号连接
# driver.find_element(by=By.CSS_SELECTOR,
#                     value=".emailA.dzyxA").send_keys("123456@qq.com")
# driver.find_element(By.CSS_SELECTOR, "button").click()  # 标签名
# # 等待3秒
# time.sleep(3)



import time
from selenium import webdriver
from selenium.webdriver.common.by import By
# 创建浏览器驱动
driver = webdriver.Chrome()
# 获取访问页面
driver.get("http://121.43.169.97:8848/pageA.html")
# 放大浏览器
driver.maximize_window()
time.sleep(1)
# 模拟用户操作
# 获取用户名：
driver.find_element(By.CSS_SELECTOR,"p>input").send_keys("admin") # 父子关系
driver.find_element(By.CSS_SELECTOR,"form input").send_keys("test") # 上下级关系
driver.find_element(By.CSS_SELECTOR,"input[id*='pass']").send_keys("123456") # 元素和属性模糊匹配扩展
# 等待3秒
time.sleep(3)